﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using MyFinanceManager.Controls;

namespace MyFinanceManager
{
    public partial class ucGasprice : FiringUserControl
    {
        public double Value
        {
            get
            {
                double value = this.upAndDowner0.Value;
                value += (double)this.upAndDowner1.Value / 10;
                value += (double)this.upAndDowner2.Value / 100;
                value += (double)this.upAndDowner3.Value / 1000;
                return value;
            }
        }

        public ucGasprice()
        {
            InitializeComponent();

            this.upAndDowner0.ValueChanged += new EventHandler(upAndDowner_ValueChanged);
            this.upAndDowner1.ValueChanged += new EventHandler(upAndDowner_ValueChanged);
            this.upAndDowner2.ValueChanged += new EventHandler(upAndDowner_ValueChanged);
            this.upAndDowner3.ValueChanged += new EventHandler(upAndDowner_ValueChanged);
        }

        void upAndDowner_ValueChanged(object sender, EventArgs e)
        {
            FireNewValueAvailable(this.Value.ToString("N3") + " EUR/l");
        }
    }
}
